package com.waimai.www.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.waimai.www.po.Users;
import com.waimai.www.service.UserService;
import com.waimai.www.vo.Dingcandata;

@Controller
public class UserController {

	//响应订餐模块的数据,仅仅用于数据获取
	@Autowired
	private Dingcandata dingcandata1;
	
	//用于存储已经查好的数据
	public Dingcandata dingcandata;

	
	///相应订餐模块的调用///未登录状态///首次访问主页url:localhost:8080/project_demo/
	@RequestMapping("/")
	public ModelAndView dingcaninfo( ModelAndView mv) {
		dingcandata=dingcandata1.not_login();
		mv.addObject("dingcandata", dingcandata);
		mv.setViewName("1");
		
		return mv;
	}
	//先不做后台校验//登录状态///个人中心跳转主页url:localhost:8080/project_demo/{id}
	@RequestMapping("/{id}")
	public ModelAndView dingcan_logininfo( @PathVariable("id") Integer id,ModelAndView mv) {
		dingcandata=dingcandata1.login(id);
		mv.addObject("dingcandata", dingcandata);
		mv.setViewName("2");
		
		return mv;
	}
	
}
